<?php
if (!defined("IN_OP"))
{
    exit("You can't access this file directly...");
}
$sid=getvar("sid");
if($sid=="") $sid=2;
$t=getvar("t");
if($t=="") $t="lx";

$ui = new UI(true,'',true);
$tpl = new Template_Member();
$tpl->load(array("main" => "6h/lx.tpl", "menu" => "6h/6h_menu.tpl","header"=>"game_header.tpl","foot"=>"game_foot.tpl"));
$tpl->set($fp," class='select'");
$tpl->set('tblName','六合彩');
$tpl->show("menu");
if ($curruser['enabled'] != 1)
{
    $ui->showErrorPage("<p class=error>帐号已被暂停使用</p>");
    exit();
}
$rs = getdb("select * from lotto where open>='" . date("Y-m-d") . "' order by open limit 1");
if ($rs->eof)
{
    $ui->showErrorPage("<div class='time'><div class='timeDiv2'>以官方公告为准</div></div>");
    exit();
}
$open = $rs->f['open'];
$round = $rs->f['round'];
$lotto_id = $rs->f['id'];
$stopbet = $conf->get("stopbet");
if (date("Y-m-d") < $open)
{
    $ui->showErrorPage("<div class='time'><div class='timeDiv2'>以官方公告为准</div></div>");
    exit();
}
else if (date("Y-m-d") == $open)
{
    if ($stopbet <= date("Hi"))
    {
        $ui->showErrorPage("<div class='time'><div class='timeDiv2'>以官方公告为准</div></div>");
        exit();
    }
    else if (date("Hi") <= $conf->get("startbet"))
    {
        $ui->showErrorPage("<p class=error>目前非下单时段</p><script>setTimeout('location.reload()',30000);</script>");
        exit();
    }
}
$tpl->set("cchinayear", intval($conf->get("chinayear")));
$t1 = strtotime($open . " " . $stopbet);
$tpl->Set("timestap", $t1 - systime());
$tpl->set("phptime", systime());
$tpl->set("open", $open);
$tpl->set("round", d3($round));
$tpl->set("lotto_id", $lotto_id);
$tpl->set("betName","连肖");
$tpl->set("gametype",0);
$tpl->set("sid",$sid);
$tpl->set("t",$t);
$tpl->set("fp",$t=='lx'?'proc18':'proc36');
$tpl->set("lx",$t=='lx'?'':'disabled');
$tpl->set("ws",$t=='ws'?'':'disabled');
$tpl->set("betjs",$t=='lx'?'bet10':'bet36');
$select_disk = getUserValidDiskSelect($curruser, "document.location='op.php?op=member&fp=bet10&t=".$t."&sid='+$('input[name=type]').val()+'&disk='+this.value");
$tpl->set("select_disk", $select_disk);
$disk = $g_disk_code[getUserValidDisk( $curruser )];
$idisk = getUserValidDisk( $curruser );

$rs = getdb( "select * from rate27 where lotto_id={$lotto_id} and disk={$idisk} and subid=".($sid>=20?2:$sid)."");
if ( $rs->eof )
{
    $ui->showErrorPage( "<p class=error>系统目前维护中，请稍後！</p>" );
    exit();
}
$tpl->set( "r17_1", round($rs->f["r01"],2) );
$tpl->set( "r17_2", round($rs->f["r02"],2) );
$tpl->set( "r17_3", round($rs->f["r03"],2) );
$tpl->set( "r17_4", round($rs->f["r04"],2) );
$tpl->set( "r17_5", round($rs->f["r05"],2) );
$tpl->set( "r17_6", round($rs->f["r06"],2) );
$tpl->set( "r17_7", round($rs->f["r07"],2) );
$tpl->set( "r17_8", round($rs->f["r08"],2) );
$tpl->set( "r17_9", round($rs->f["r09"],2) );
$tpl->set( "r17_10", round($rs->f["r10"],2) );
$tpl->set( "r17_11", round($rs->f["r11"],2) );
$tpl->set( "r17_12", round($rs->f["r12"],2) );
$rs->close();
$rs = getdb( "select * from rate36 where lotto_id={$lotto_id} and disk={$idisk} and subid=".($sid<20?21:$sid));

if ( $rs->eof )
{
    $ui->showErrorPage( "<p class=error>系统目前维护中，请稍後！</p>" );
    exit();
}
for($i=0;$i<10;$i++)
$tpl->set( "ws_".$i, round($rs->f["r".$i],2) );
$rs->close();
foreach($g_chinayearnum as $key=>$val)
{
	$arr=$val;
	foreach($arr as $k=>$v)
		$arr[$k]=sprintf('%02d',$v);
	$tpl->set('num_'.$key,join(",",$arr));	
}	

$tpl->show("header");
$tpl->show("main");
$tpl->show("foot");
?>